import random
from time import sleep
from devices import dv

lx = ['视频', '音乐', '图片']
random.randint(1, 3)


def video():
    dv.app_start('com.visteon.txzing.photovideo')
    dv(text='U盘').click()
    dv(text='视频').click()
    dv.xpath(
        '//*[@resource-id="com.visteon.txzing.photovideo:id/recyclerview"]/android.view.ViewGroup[3]/android.widget.ImageView[1]').click()


def photo():
    dv.app_start('com.visteon.txzing.photovideo')
    dv(text='U盘')
    dv(text='图片').click()
    dv.xpath('//*[@resource-id="com.visteon.txzing.photovideo:id/recyclerview"]/android.view.ViewGroup[1]/android.widget.ImageView[1]').click()


def media():
    dv.app_start('com.visteon.txzing.media')
    dv.xpath('//*[@text="USB音乐"]').click()
    dv.xpath('//*[@text="全部歌曲"]').click()
    dv.xpath(
        '//*[@resource-id="com.visteon.txzing.media:id/rcvAudioList"]/android.view.ViewGroup[1]/android.widget.TextView[2]').click()


# video()

#
#
#
# '''这些是通过观察元素属性观察得出的结论，这些是通用值'''
# def tu(number):
#     '''家人时光每个图片定位'''
#     tu = dv.xpath(
#         f'//*[@resource-id="com.visteon.txzing.familytime:id/recycler_view"]/android.view.ViewGroup[{number}]/android.widget.ImageView[1]')
#     return tu
# #设为按钮
# set_as=dv(text='设为')
# #设置壁纸
# set_wallpaper = dv.xpath('//*[@resource-id="com.visteon.txzing.familytime:id/check_wallpaper"]')
# #设置屏保
# set_screensaver = dv.xpath('//*[@resource-id="com.visteon.txzing.familytime:id/check_screensaver"]')
# #设为按钮
# confirm=dv.xpath('//*[@resource-id="com.visteon.txzing.familytime:id/btn_normal_allow"]')
# #取消按钮
# cancel=dv.xpath('//*[@resource-id="com.visteon.txzing.familytime:id/btn_normal_cancel"]')
# while True:
#     sleep(5)
#     for i in range(1,6):
#         print(i)
#         tu(i).click()
#         sleep(1)
#         set_as.click()
#         sleep(1)
#         set_screensaver.click()
#         sleep(1)
#         set_wallpaper.click()
#         sleep(1)
#         confirm.click()
# # tu(1).click()
# # set_as.click()
# # set_screensaver.click()
# # set_wallpaper.click()
# # confirm.click()
#
# '''前提条件，没有图片被设置为屏保或壁纸，多种设置，取消场景'''
# '''1、图片设置为壁纸屏保，断言图片标签和提示文案'''
# '''2、图片取消为壁纸屏保，断言提示文案'''
# dv.app_start('com.visteon.txzing.familytime')

# wb=dv.xpath('//*[@resource-id="com.visteon.txzing.accountcenter:id/feedback_content"]')
# # wb.set_text(
# #         '坤徐坤坤111坤蔡徐坤坤111坤蔡徐坤坤111坤蔡徐坤坤111坤蔡徐坤坤111坤蔡徐坤坤111坤蔡徐坤坤111坤蔡徐坤坤111坤蔡'
# #         '徐坤坤111坤蔡徐坤坤111坤蔡徐坤坤111坤蔡徐坤坤111坤蔡徐')
# wb.set_text('ssssssssssssssssssssssssssssssssssssssssss')

dv.swipe(126, 15, 115, 561, 0.1)
